<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('Auth/administrators')}">管理员列表</a>
</div>
<form class="form-horizontal" id="handleposition" action="{:U('Auth/edit_admin')}" method="post">
    <div class="permissions-content">
        <div class="permissions-le">
            <span class="add-admin"><a href="javascript:history.go(-1)"></a>修改管理员</span>
            <div class="add-admin-ipt">
                <span>所在组:</span>
                <select name="role_id" id="roleId">
                    <option value="">-- 请选择 --</option>
                    <foreach name="roleList" item="role">
                        <option value="{$role['role_id']}" <if condition="$manager['role_id'] eq $role['role_id']">selected</if>>{$role['name']}</option>
                    </foreach>
                </select>
            </div>
            <div class="add-admin-ipt">
                <span><i>*</i>姓名:</span>
                <input type="text" disabled placeholder="请填写管理员姓名" class="w200" value="{$manager['user_name']}"/>
            </div>
            <div class="add-admin-ipt">
                <span><i>*</i>手机:</span>
                <input type="text" value="{$manager.mobile}" name="mobile" id="mobile" maxlength="11" data-type="number" placeholder="请填写管理员手机" class="w200" required/>
            </div>
            <div class="add-admin-ipt">
                <span><i>*</i>邮箱:</span>
                <input type="text" name="email" id="email" placeholder="请填写管理员邮箱" class="w200" value="{$manager.email}" required/>
            </div>
            <div class="add-admin-ipt">
                <span><i>*</i>密码:</span>
                <input type="password" name="pwd" id="pwd" placeholder="请填写管理员密码" class="w200"/>
            </div>
            <div class="add-admin-ipt">
                <span></span>
                <input type="hidden" name="manager_id" value="{$manager.manager_id}"/>
                <a class="btn-lg btn-blue" id="submitBtn">保存</a>
            </div>
        </div>
        <div class="permissions-ri">
            <a href="" class="permissions-help">帮助和服务</a>
        </div>
    </div>
</form>
</div>
<script type="text/javascript">
    $(function(){
        $('#submitBtn').click(function () {
            var mobile = $('#mobile').val();
            var email = $('#email').val();
            var roleId = $('#roleId').val();
            if (roleId == '') {
                layer.alert('角色必选！');
                return false;
            }
            var mobilePattern = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
            if (!mobilePattern.test(mobile)) {
                layer.alert('手机号码有误！');
                return false;
            }
            if (email == '') {
                layer.alert('邮箱必填！');
                return false;
            }
            $("#handleposition").submit();
        });
    });
</script>
<include file="common:__foot__"/>